<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>Eval：字符串当成js代码来执行</title>
		<script>
			var a=4,b=20;
			var str="while(a++<b){console.log(a,b);}";
			var c=str;
			alert(eval(c));
		</script>
	</head>
	<body>
	</body>
</html>